package com.fr.web;

import com.fr.report.RWorkBook;
import com.fr.report.ResultWorkBook;
import com.fr.report.io.TemplateImporter;
import com.fr.web.core.ShowWorkBookPolicy;
import java.io.InputStream;

public class EmbeddedResultResultlet extends Resultlet
{
  private String tplPath;
  private ShowWorkBookPolicy policy;

  public EmbeddedResultResultlet(String paramString, ShowWorkBookPolicy paramShowWorkBookPolicy)
  {
    this.tplPath = paramString;
    this.policy = paramShowWorkBookPolicy;
  }

  public ResultWorkBook createReport(ReportletRequest paramReportletRequest)
    throws ReportletException
  {
    RWorkBook localRWorkBook;
    InputStream localInputStream;
    try
    {
      localInputStream = EmbeddedTplReportlet.class.getResourceAsStream(this.tplPath);
      localRWorkBook = new TemplateImporter().generateResult(localInputStream);
      localInputStream.close();
    }
    catch (Exception localException)
    {
      throw new ReportletException(localException.getMessage(), localException);
    }
    return localRWorkBook;
  }

  public void setPolicy(ShowWorkBookPolicy paramShowWorkBookPolicy)
  {
    this.policy = paramShowWorkBookPolicy;
  }

  public ShowWorkBookPolicy getPolicy()
  {
    return this.policy;
  }
}